Skip to content

Fix code quality check#187

Closed
laustam wants to merge 4 commits into1a1a11a:developfrom
laustam:code-quality-check
Closed

Fix code quality check#187
laustam wants to merge 4 commits into1a1a11a:developfrom
laustam:code-quality-check

Conversation

@laustam
Copy link
Copy Markdown
Contributor

@laustam laustam commented May 28, 2025

Issue

The code-quality.yaml includes a clang-tidy formatter that has not been run previously due to its configuration.

Fix

  1. Ensure that all C and C++ files are captured and the code quality CI runs on all files
  2. Reformat the whole repository to conform to the clang-tidy formatter
  3. Add git blame to ignore changes made from reformatting files

@laustam laustam changed the title Code quality check Fix code quality check May 28, 2025
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6 Security Hotspots
8.7% Duplication on New Code (required ≤ 3%)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@laustam
Copy link
Copy Markdown
Contributor Author

laustam commented May 28, 2025

SonarCloud is reporting "issues" that were already present in the code, it has only now been triggered due to the repository-wide reformat. What do you suggest @1a1a11a?

@laustam laustam mentioned this pull request May 28, 2025
@mack-w
Copy link
Copy Markdown

mack-w commented Jun 1, 2025

SonarCloud is reporting "issues" that were already present in the code, it has only now been triggered due to the repository-wide reformat. What do you suggest @1a1a11a?

I'm facing similar problem, I checked the reported issue closely and I'm pretty sure that there won't be a problem.
FYI, the src and dest of strcpy() can only be some predefined strings (mapping to cache algorithms), not something arbitrary.

@1a1a11a
Copy link
Copy Markdown
Owner

1a1a11a commented Jun 1, 2025

Maybe we can suppress the warning?

@mack-w
Copy link
Copy Markdown

mack-w commented Jun 3, 2025

Maybe we can suppress the warning?

I guess configuring the CI platform is needed to suppress the warning :)

@1a1a11a 1a1a11a requested a review from Copilot June 18, 2025 21:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR activates and enforces the clang-tidy formatter across the entire C/C++ codebase, reformatting all affected files for style consistency and fixing a script typo in the install helper.

  • Expanded CI to include all C/C++ files and run clang-tidy
  • Reformatted nearly every source file: wrapped long lines, aligned parameters, standardized include ordering
  • Corrected a variable reference typo in the install script

Reviewed Changes

Copilot reviewed 181 out of 260 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/test_profilerLRU.c Wrapped array initializer and test call arguments across lines
test/test_prefetchAlgo.c Wrapped helper signature and test calls across lines
test/test_mrcProfiler.cpp Reformatted includes and test function calls for clang-tidy
test/test_glcache.c Reformatted helper and printf calls
test/test_evictionAlgo.c Reformatted helper signature and multi-size simulation calls
test/test_dist.c Reformatted test registration calls
test/test_dataStructure.c Reformatted test registration call
test/test_admissionAlgo.c Reformatted helper signature and test logic
test/test_MRC.c Reformatted comment blocks and includes
test.c Removed duplicate include and fixed include order
scripts/install_libcachesim.sh Fixed typo in SOURCE variable reference
random/allocator.c Reformatted includes and inline functions
libCacheSim/utils/mymath.c Moved set_rand_seed definition and reformatted linear_regression
libCacheSim/utils/include/mysys.h Removed trailing whitespace
libCacheSim/utils/include/myprint.h Removed trailing whitespace
libCacheSim/utils/include/mymath.h Reformatted function declaration
libCacheSim/utils/dep/mem.c Reformatted mmap calls and allocator logic
libCacheSim/traceReader/sampling/spatial.c Removed duplicate include and reformatted else block
libCacheSim/traceReader/sampling/SHARD.c Reformatted conditional sampling logic
libCacheSim/traceReader/reader.c Reformatted setup and verbose logging calls
libCacheSim/traceReader/generalReader/zstdReader.c Reformatted decompress and read functions
libCacheSim/traceReader/generalReader/txt.c Reformatted verbose logging and error messages
libCacheSim/traceReader/generalReader/libcsv.h Reformatted macro definitions
libCacheSim/traceReader/generalReader/libcsv.c Reformatted error messages array
libCacheSim/traceReader/customizedReader/vscsi.h Reformatted conditional cmd checks
libCacheSim/traceReader/customizedReader/valpinBin.h Reformatted function definitions
libCacheSim/traceReader/customizedReader/oracle/oracleTwrNSBin.h Reformatted conditional reuse logic
libCacheSim/traceReader/customizedReader/oracle/oracleTwrBin.h Reformatted conditional reuse logic
libCacheSim/traceReader/customizedReader/oracle/oracleGeneralBin.h Reformatted conditional skip logic
libCacheSim/traceReader/customizedReader/lcs.h Reformatted struct assertions
libCacheSim/traceReader/customizedReader/lcs.c Reformatted error and summary prints
libCacheSim/traceReader/customizedReader/binaryUtils.h Reformatted read_bytes function
libCacheSim/traceAnalyzer/utils/utilsSys.cpp Reformatted includes and affinity prints
libCacheSim/traceAnalyzer/utils/utils.cpp Added missing include and formatted includes
libCacheSim/traceAnalyzer/utils/threadPool.cpp Reformatted shutdown and wait logic
libCacheSim/traceAnalyzer/utils/include/utilsSys.h Removed trailing whitespace
libCacheSim/traceAnalyzer/utils/include/utilsStr.h Reformatted include order
libCacheSim/traceAnalyzer/utils/include/utilsPrint.h Reformatted printing functions
libCacheSim/traceAnalyzer/utils/include/utilsMath.h Reformatted math utilities
libCacheSim/traceAnalyzer/utils/include/utilsCompress.h Reformatted gzip compress/decompress
libCacheSim/traceAnalyzer/utils/include/threadPool.h Reformatted thread pool header
libCacheSim/traceAnalyzer/utils/include/linReg.h Reformatted linreg implementation
libCacheSim/traceAnalyzer/struct.h Removed trailing whitespace
libCacheSim/traceAnalyzer/reuse.h Reformatted constructor parameters
libCacheSim/traceAnalyzer/reqRate.cpp Removed trailing whitespace
libCacheSim/traceAnalyzer/plotData/heatmapData.h Reformatted inline functions and array initialization
libCacheSim/traceAnalyzer/op.h Reformatted include order
libCacheSim/traceAnalyzer/experimental/sizeChange.h Reformatted includes
libCacheSim/traceAnalyzer/experimental/scanDetector.h Reformatted conditional loops
libCacheSim/traceAnalyzer/experimental/createFutureReuseCCDF.h Reformatted includes
libCacheSim/traceAnalyzer/dep/writeReuse.h Reformatted assertions and I/O logic
libCacheSim/traceAnalyzer/dep/writeFutureReuse.h Reformatted reuse logic and I/O operations
libCacheSim/traceAnalyzer/analyzer.h Reformatted initializer lists
libCacheSim/traceAnalyzer/analyzer.cpp Reformatted includes and extra include
libCacheSim/traceAnalyzer/accessPattern.h Removed trailing whitespace
Comments suppressed due to low confidence (1)

scripts/install_libcachesim.sh:5

  • The closing brace in "$SOURCE}" is mismatched; it should be either ${SOURCE} or simply $SOURCE to correctly reference the variable.
DIR=$(dirname $SOURCE})

@laustam laustam force-pushed the code-quality-check branch from 1685aa9 to f2116a5 Compare June 20, 2025 20:28
@1a1a11a
Copy link
Copy Markdown
Owner

1a1a11a commented Jun 21, 2025

I am expecting to fix all the relative import after the cmake clean up. It may change and reformat a lot of files, which may cause a conflict with this PR. What is the current status of this PR?

@laustam
Copy link
Copy Markdown
Contributor Author

laustam commented Jun 21, 2025

I am expecting to fix all the relative import after the cmake clean up. It may change and reformat a lot of files, which may cause a conflict with this PR. What is the current status of this PR?

The PR is out of sync with the main branch due to recent changes... might be best to delay a repository-wide refactor after major changes have been made.

@1a1a11a
Copy link
Copy Markdown
Owner

1a1a11a commented Jun 22, 2025

This should have been fixed in #203, please let us know if there are more errors from clang-format.

@1a1a11a 1a1a11a closed this Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants